
var app =angular.module('myApp');
app.controller('myCtrl', function($scope,$location,$http,$timeout){
	$scope.firstName = "Mercy";
	$scope.lastName = "Yang";
	$scope.fullName = function(){
		return $scope.firstName+" "+$scope.lastName;
	};
	$scope.names = [
        {name:'Jani',country:'Norway'},
        {name:'Hege',country:'Sweden'},
        {name:'Kai',country:'Denmark'}
    ];

    $scope.$watch('firstName',function(newVal,oldVal,scope){
        if (newVal!=oldVal) {
            alert(newVal);
        };
    })

    $timeout(function(){
        $scope.firstName="Mercy1";

    },1000);
})
